import Vue from 'vue'
import Router from 'vue-router'

import Login from '../views/Login/index'
import Home from '../views/Home/index'
import Add from '../views/Add/index'
import About from '../views/About/index'
//import NotFound from '../views/errorPage/404'
Vue.use(Router)

/* 初始路由 */
export default new Router({
    routes: [
        {
            path: '/',
            redirect: '/home'
          },
        {
            name: 'login',
            path: '/login',
            component: Login
        },
         
        {
            path: '/home',
            name: 'home',
            component: Home,
            meta: {
                requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
            },
        }, 
        {
            path: '/Add',
            name:'Add',
            component: Add,
            meta: {
                requireAuth: true, 
            }
        },
        {
            path: '/About',
            name:'About',
            component: About,
            meta: {
                requireAuth: true, 
            }
        }
    ]
})
